shr.defineClass("shr.buscost.buscostcountlist", shr.framework.List, {
	 
	initalizeDOM : function () {
		shr.buscost.buscostcountlist.superClass.initalizeDOM.call(this);
	},
	/**
	* 反审批
	*/
	againstApproveAction : function(){
		var self = this;
	
		var billIds = $("#grid").jqGrid("getSelectedRows");

		/*每次只允许反审批一条记录*/
		
		if (billIds.length > 1) {
			shr.showWarning({
				message:"请选择一条记录进行反审批！",
				hideAfter:3
			});
			return;
		}
		
		if (billIds == undefined || billIds.length==0 || (billIds && billIds.length == 1 && billIds[0] == "")) {
			shr.showError({message: "请选中行！ "});
			return ;
		}else{
			self.remoteCall({
				method:'isApprove', // 是否审批通过
				param : {
					billId : billIds[0]
				},
				success:function(res){
					var info = res; 

					if(info != null && !info.msg){
						var error = "不能对没有审批通过的单据进行反审批";
						shr.showError({message: error});
						return;
					}
				}
			});

			
		}

		shr.showConfirm('您确认要反审批吗？', function(){
			var billIds = $("#grid").jqGrid("getSelectedRows");
			   self.remoteCall({
				method:"againstApprove",
				param : {
					billId : billIds[0]
				},
				success:function(res){
					if(res.flag == "1")
					{
						shr.showInfo({message: "反审批成功"});
						self.queryGrid();
					}else{
						shr.showError({message: "反审批失败"});
					} 
				}
			});
		});
	}
});

